using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using BA.DAL;
using Microsoft.VisualBasic;

namespace BlazeApps.Library.Search
{
    public class PageSearch : Base
    {
        //(title like ''%%'' OR summary like ''%%'' OR body like ''%%'')
        private BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
        private Procedures Procs = new Procedures();

        public DataSet GetPageResults(string WhereClause, string ItemType)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@whereclause", DbType.String, WhereClause);
            DAL.AddParameter("@itemtype", DbType.String, ItemType);

            return DAL.GetDataSet(Procs.SearchItems.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataSet GetPageResultsByTag(string WhereClause, string ItemType)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@whereclause", WhereClause);
            DAL.AddParameter("@itemtype", ItemType);

            return DAL.GetDataSet(Procs.SearchItemsByTag.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }
    }
}
